#include "Clusters.h"

istream& operator>>(istream& from, Clusters& s){
	unsigned int clusterSize;
	char c;
	from >> clusterSize;

	for( unsigned int i = 0; i < clusterSize; i++){
		unsigned long clusterNumber;
		from >> clusterNumber;
		Clusters::iterator current = s.insert(s.lower_bound(clusterNumber), Clusters::value_type(clusterNumber, Cluster()));
		from >> current->second;
		from.get(c);
	}

	return from;
}

ostream& operator<<(ostream& os, const Clusters& s){
	os << s.size() << "\n";
	for(Clusters::const_iterator cluster = s.begin(); cluster != s.end(); cluster++){
		os << cluster->first << "\n" << cluster->second << "\n";
	}
	return  os;
}